package com.kandinfo.survey.common.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;

import com.kandinfo.base.common.repository.BaseRepository;
import com.kandinfo.survey.common.domain.UserQuestionnaireRela;

public interface UserQuestionnaireRelaRepository extends BaseRepository<UserQuestionnaireRela, Long> {

    @Query(value = "select * from user_questionnaire_rela where user_id=?1 and status='1'", nativeQuery = true)
    List<UserQuestionnaireRela> findQuestionnaire(Long userId);
    
    @Query(value = "select * from user_questionnaire_rela where user_id=?1 and questionnaire_id = ?2 and status='1' ", nativeQuery = true)
    UserQuestionnaireRela findOneQuestionnaire(Long userId, Long questionnaireId);

}
